// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App'
import router from './router'
import $ from 'jquery'
import axios from 'axios'
import VideoPlayer from 'vue-video-player'
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
import qs from 'qs'
import 'lib-flexible/flexible'
import moment from 'moment/moment'
import Vuex from 'vuex'
import CountDown from 'vue2-countdown'
import Store from '../vuex/store'
import VueTouch from 'vue-touch'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import MintUI from 'mint-ui';
import 'mint-ui/lib/style.css';

//import YDUI from 'vue-ydui'; /* 相当于import YDUI from 'vue-ydui/ydui.rem.js' */
//import 'vue-ydui/dist/ydui.rem.css';
Vue.use(MintUI)
Vue.use(VueTouch, {
	name: 'v-touch'
})
Vue.use(VueRouter);
Vue.use(VideoPlayer);
Vue.use(preview);
Vue.use(ElementUI);
Vue.use(Vuex);
//Vue.use(YDUI);
VueTouch.config.swipe = {

	threshold: 100 //手指左右滑动距离

}
Vue.prototype.$axios = axios;

Vue.prototype.$store = Store;

//Vue.http.interceptors.push((request, next) => {
////  /uaa/oauth/token
//if (request.url !== "/uaa/oauth/token") {
//  // request.headers.set('Content-Type', 'application/json;charset=UTF-8',)
//  request.headers.set('Authorization', Api.getToken())
//}
//// continue to next interceptor
//next((response) => { //在响应之后传给then之前对response进行修改和逻辑判断。对于token时候已过期的判断，就添加在此处，页面中任何一次http请求都会先调用此处方法
//  if (response.status == '401') {
//    router.push('/login_land')
//    // ElementUI.message.error('token已过期，请重新登录')
//  }
//  return response
//})
//})
Vue.config.productionTip = false
Vue.config.debug = true;
axios.defaults.withCredentials = true;
Vue.prototype.strToTime = function(str) {
	for(let i = 1; i <= 30; i++) {
		let timestr = "time" + i;
		let nowtime = 700;
		if(str == timestr) {
			nowtime = 700 + (i - 1) * 50;
			let nowtimestr = nowtime.toString();
			if(nowtimestr.length == 3) {
				let one = nowtimestr.charAt(0);
				let two = nowtimestr.charAt(1);
				if(two == "5") {
					two = "30";
				} else {
					two = "00";
				}
				let result = one + ":" + two;
				return result;
			}
			if(nowtimestr.length == 4) {
				let one = nowtimestr.charAt(0);
				let two = nowtimestr.charAt(1);
				let three = nowtimestr.charAt(3);
				if(three == "5") {
					three = "30";
				} else {
					three = "00";
				}
				let result = one + two + ":" + three;
				return result;
			}

		}
	}
}
/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	Store,
	components: {
		App
	},
	template: '<App/>'
})
